package org.rency.mq.kafka.consumer.handler;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.kafka.listener.AbstractMessageListenerContainer;
import org.springframework.kafka.listener.KafkaDataListener;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

/**
 * 抽象消费者处理器
 *
 * @author: Created by user_rcy@163.com on 2016/10/19.
 * @version: V1.0.0
 * @since JDK 1.8
 */
public abstract class AbstractHandler<K, V> implements MessageHandler<K, V> {

    protected final Logger logger = LoggerFactory.getLogger(this.getClass());

    /**
     * 获取处理器名称
     * @return
     */
    public abstract String getHandlerName();

    /**
     * 获取消费者组名称
     * @return
     */
    public abstract String getGroupName();

    /**
     * 获取消费者监听器监听Topic
     * @return
     */
    public abstract String getTopicName();

    /**
     * 获取消息Key数据类型
     * @return
     */
    public abstract Class<?> getKeyGenericClass();

    /**
     * 获取消息内容数据类型
     * @return
     */
    public abstract Class<?> getValueGenericClass();

    /**
     * 获取消费者监听器线程池
     * @return
     */
    public abstract ThreadPoolTaskExecutor getTaskExecutor();

    /**
     * 获取监听器,单笔、批量
     * @return
     */
    public abstract KafkaDataListener getMessageListener();

    /**
     * 获取消息监听模式
     * @return
     */
    public abstract AbstractMessageListenerContainer.AckMode getAckMode();

}
